unit U_fm_pesq_cliente;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.Grids, Vcl.DBGrids,
  Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls;

type
  Tfm_pesq_cliente = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    lbl_item: TLabel;
    rdg_opcao: TRadioGroup;
    edt_descricao: TEdit;
    btn_loc: TBitBtn;
    Panel3: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel4: TPanel;
    DBGrid1: TDBGrid;
    DataSource2: TDataSource;
    procedure FormShow(Sender: TObject);
    procedure btn_locClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_pesq_cliente: Tfm_pesq_cliente;

implementation

{$R *.dfm}

uses U_dm_principal;

procedure Tfm_pesq_cliente.btn_locClick(Sender: TObject);
begin
 dm_principal.cds_cliente.Close;
       dm_principal.sq_cliente.SQL.Text:= 'select c.id,'
                                            +#13+'c.regiao,'
                                            +#13+'c.forma_pagamento,'
                                            +#13+'c.data_ultima_compra,'
                                            +#13+'c.valor_ultima_compra,'
                                            +#13+'c.limite_credito,'
                                            +#13+'c.status,'
                                            +#13+'c.conta_credito,'
                                            +#13+'c.conta_debito,'
                                            +#13+'c.cep_entrega,'
                                            +#13+'c.tipo_logradouro,'
                                            +#13+'c.numero,'
                                            +#13+'c.bairro,'
                                            +#13+'c.municipio,'
                                            +#13+'c.data,'
                                            +#13+'c.hora,'
                                            +#13+'c.pai,'
                                            +#13+'c.mae,'
                                            +#13+'c.desconto_maximo,'
                                            +#13+'c.uf_1,'
                                            +#13+'c.ie,'
                                            +#13+'c.nome,'
                                            +#13+'c.apelido,'
                                            +#13+'c.tipo_pessoa,'
                                            +#13+'c.cpf,'
                                            +#13+'c.rg,'
                                            +#13+'c.dt_nascimento,'
                                            +#13+'c.regime_tributario,'
                                            +#13+'c.porte_pessoa_juridica,'
                                            +#13+'c.tipo_atividade,'
                                            +#13+'c.tipo_contribuinte,'
                                            +#13+'c.logradoro,'
                                            +#13+'c.complemento,'
                                            +#13+'c.ddd1,'
                                            +#13+'c.ddd2,'
                                            +#13+'c.telefone1,'
                                            +#13+'c.telefone2,'
                                            +#13+'c.home_page,'
                                            +#13+'c.obs,'
                                            +#13+'c.e_mail, '
                                            +#13+'c.tabela_preco,'
                                            +#13+'c.vendedor'
                                            +#13+'from cliente c'
                                            +#13+' where c.nome <> ' + QuotedStr('') ;
         if  length(trim(edt_descricao.Text))>0 then
             dm_principal.sq_cliente.SQL.Add(' and  c.nome containing '+QuotedStr(edt_descricao.Text));
             dm_principal.cds_cliente.open;
end;

procedure Tfm_pesq_cliente.FormShow(Sender: TObject);
begin
  dm_principal.cds_cliente.Open;
end;

end.
